using UnityEngine;

public class ThunderStrikeController : MonoBehaviour
{
    private PlayerStats playerStats;

    protected virtual void Start()
    {
        playerStats = FindObjectOfType<PlayerStats>();
    }

    protected virtual void OnEnable()
    {
        if (playerStats == null)
        {
            playerStats = FindObjectOfType<PlayerStats>();
        }
    }

    protected virtual void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.TryGetComponent(out EnemyStats enemy))
        {
            playerStats.DoMagicalDamage(enemy);
        }
    }
}
